import React from 'react';
import style from './index.css'
import { connect } from 'react-redux';
import { createBrowserHistory } from 'history'
const history = createBrowserHistory();
import Headers from "@react/components/header/index.jsx";
import qs from "qs";
class RankingList extends React.Component {
  constructor(...props) {//构建函数 created  
    super(...props); //需要手动调用
  };
  goBack() { //返回上一页
    history.go(-1)
    // history.back()
  };
  btnClick(num){
    console.log(num)
  };
  render() {
    const props = this.props
    return (
      <div>
        {/* 父传参和方法给子 */}
        <Headers name='详情' num={props.resNum} btn='数字' btnClick={this.btnClick.bind(this)} goBack={this.goBack.bind(this)}></Headers>
        <div className={style.box}>
          <div>
            计算结果{props.resNum}
          </div>
          <div onClick={this.goBack.bind(this)}>
            返回
          </div>
        </div>
      </div>
    )
  };
};
export default connect((state, props) => {
  return {
    resNum: state.common.commonNumReducer
  }
})(RankingList);